package createModel.BuilderModel.directorBuilderPlayers02;

import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 功能描述:基本配置手册生成器 手动构建时,需要校验前三个参数
 * 2024/06/10
 *
 * @author ZhangYi
 * @see AbstaractBasicConfigBuilder
 */
public class BasicConfigManualBuilder extends AbstaractBasicConfigBuilder{
    @Override
    public void buildId(long id) {
        this.basicConfig.setId(id);
    }

    @Override
    public void buildReductionEmissionFactorId(String reductionEmissionFactorId) throws IllegalAccessException {
        if (reductionEmissionFactorId == null){
            throw new IllegalAccessException("reductionEmissionFactorId is null");
        }
        this.basicConfig.setReductionEmissionFactorId(reductionEmissionFactorId);
    }

    @Override
    public void buildEmissionFactorName(String missionFactorName) throws Exception {
        if (missionFactorName == null){
            throw new IllegalAccessException("missionFactorName is null");
        }
        this.basicConfig.setEmissionFactorName(missionFactorName);
    }

    @Override
    public void buildFactorLibraryId(String factorLibraryId) throws Exception {
        this.basicConfig.setFactorLibraryId(factorLibraryId);
    }

    @Override
    public void buildGhgTypeCode(List<String> ghgTypeCode) throws IllegalAccessException {
        if (CollectionUtils.isEmpty(ghgTypeCode)){
            throw new IllegalAccessException("ghgTypeCode is null");
        }
        this.basicConfig.setGhgTypeCode(ghgTypeCode);
    }

    @Override
    public void buildDataValue(BigDecimal dataValue) {
        this.basicConfig.setDataValue(dataValue);

    }

    @Override
    public void buildFactorGrade(String factorGrade) {
        this.basicConfig.setFactorGrade(factorGrade);

    }

    @Override
    public void buildMolecularUnit(String molecularUnit) {
        this.basicConfig.setMolecularUnit(molecularUnit);
    }

    @Override
    public void builddEnominatorUnit(String denominatorUnit) {
        this.basicConfig.setDenominatorUnit(denominatorUnit);

    }

    @Override
    public void buildUpdateAt(Date updateAt) {
        this.basicConfig.setUpdateAt(updateAt);
    }
}
